package com.huirui.server.controller.mini.program;

import com.huirui.server.pojo.result.PageResult;
import com.huirui.server.pojo.result.Result;
import com.huirui.server.pojo.vo.ShortDatedProductVo;
import com.huirui.server.service.ShortDatedProductService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/short/dated/product")
@Slf4j
@Validated
@Tag(name = "临期商品管理", description = "小程序临期商品相关API")
public class ShortDatedProductController {

    @Autowired
    private ShortDatedProductService shortDatedProductService;

    @GetMapping("/list")
    @Operation(summary = "临期商品查询")
    public Result<PageResult<ShortDatedProductVo>> listShortDatedProducts(Long page, Long pageSize) {
        PageResult<ShortDatedProductVo> res = shortDatedProductService.listShortDatedProducts(page, pageSize);
        return Result.success(res);
    }

}
